package com.fanrenqiji.entity;

import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import java.util.List;

/**
 * Created by 杨 on 2017/5/22.
 */

@Entity
@Table(name = "tb_semester")
@org.hibernate.annotations.Table(appliesTo = "tb_semester",comment = "学期信息")
@org.hibernate.annotations.DynamicInsert
@org.hibernate.annotations.DynamicUpdate
@org.hibernate.annotations.Cache(region="semester", usage = CacheConcurrencyStrategy.READ_WRITE)
public class SemesterEntity  extends  DataEntity{
    @Id
    @GeneratedValue(strategy= GenerationType.IDENTITY)
    private Long id;
    @Column(columnDefinition=("varchar(200) default null comment '学期号'"))
    private String number;
    @Column(columnDefinition=("varchar(200) default null comment '房间号'"))
    private String room;
    @Column(columnDefinition=("varchar(200) default null comment '房间密码'"))
    private String password;

    @Column(columnDefinition=("TINYINT(1) default null comment '学期类型:正式1，试听0'"))
    private int formal;

    @Column(columnDefinition=("TINYINT(1) default null comment '是否招生:招生1，不招0'"))
    private int enroll;

    @Column(columnDefinition=("int(11) default null comment '报名人数'"))
    private int total;

    /*一个学期有多个家长 一个家长 貌似只能有一个学期*/
    @OneToMany(mappedBy = "semester")
    @Where(clause="del_flag="+DEL_FLAG_NORMAL)
    private List<ParentEntity> parentEntities;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    public String getRoom() {
        return room;
    }

    public void setRoom(String room) {
        this.room = room;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public List<ParentEntity> getParentEntities() {
        return parentEntities;
    }

    public void setParentEntities(List<ParentEntity> parentEntities) {
        this.parentEntities = parentEntities;
    }


    public int getFormal() {
        return formal;
    }

    public void setFormal(int formal) {
        this.formal = formal;
    }

    public int getEnroll() {
        return enroll;
    }

    public void setEnroll(int enroll) {
        this.enroll = enroll;
    }

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }
}
